﻿using CMS.Utils;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace CMS.Data.Interface.Service
{
    [NeverRegiste]
    public interface IBaseService<T>
    {
        /// <summary>
        /// 获取模型列表
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetList();
        /// <summary>
        /// 获取模型列表（条件）
        /// </summary>
        /// <param name="where">查询条件，and key1 = value1 and key2 lile %value2% ……</param>
        /// <returns></returns>
        Task<List<T>> GetList(string where);
        /// <summary>
        /// 获取模型列表（条件，分页）
        /// </summary>
        /// <param name="where">查询条件，and key1 = value1 and key2 lile %value2% ……</param>
        /// <param name="pagesize">每页数量</param>
        /// <param name="pageindex">页码</param>
        /// <returns></returns>
        Task<Tuple<List<T>, int>> GetList(int pagesize, int pageindex, string where);
        /// <summary>
        /// 获取模型
        /// </summary>
        /// <param name="modelid">模型ID</param>
        /// <returns></returns>
        Task<T> GetModel(string modelid);
        /// <summary>
        /// 添加模型
        /// </summary>
        /// <param name="model">模型</param>
        /// <returns></returns>
        Task<int> Insert(T model);
        /// <summary>
        /// 更新模型
        /// </summary>
        /// <param name="model">模型</param>
        /// <returns></returns>
        Task<int> Update(T model);
        /// <summary>
        /// 删除模型
        /// </summary>
        /// <param name="modelid">模型ID</param>
        /// <returns></returns>
        Task<int> Delete(string modelid);
        /// <summary>
        /// 批量删除模型
        /// </summary>
        /// <param name="where">查询条件，and key1 = value1 and key2 lile %value2% ……</param>
        /// <returns></returns>
        Task<int> BatchDelete(string where);
    }
}
